Home

Week 10 - Input Devices

The task

Measure something: add an input device to a board and read it.

The Execution

Shock Sensor + Fabduino

The shock sensor is part of the Cutedigi Arduino Sensor Kit. It outputs a state high/low to shocks. High = shock. Low = no shock

Signal, VCC & GND termianls connected to the Fabduino via the programming pins.

The following code reads the high/low shock status and outputs to the LED. Here A shock will turn the LED off.

int Led=13;
int Shock=11;
int val;
void setup()
{
pinMode(Led,OUTPUT);
pinMode(Shock,INPUT);//
}
void loop()
{
val=digitalRead(Shock);
if(val==HIGH)
{
digitalWrite(Led,LOW);
}
else
{
digitalWrite(Led,HIGH);
}
}

Whilst being a very simple code and process the results are fairly ambiguous. It requires a significant shock to turn the LED off.

Hello Temp

Hello Temp is another of Neil Gershenfeld's designs, relying on an Attiny 45v micro-controller and a thermister - variable resistor.

link to board files

The milled and Soldered board

The following instructions are for using mac OSX

You will need the following files:
hello.temp.45.c
hello.temp.45.make
hello.temp.45.py

And you will also need the pySerial module to allow the python program to access the data being recieved at the serial port.
Overview
Download

Install the pySerial

  • Extract the download folder and save to desktop.
  • Open Terminal and navigate to location of setup file using command: sudo cd Desktop/pyserial-2.5
  • Use Terminal to run the setup by using the command: python setup.py install
  • ----setup complete----

    Run the make file

    Connect the board with the FTDI cable and connect the programmer.
    With the above 3 files saved to desktop use the following commands

  • cd
  • sudo cd Desktop/
  • ---to navigate you from the pyserial folder to the desktop---
  • sudo make -f hello.temp.45.make program-usbtiny
  • ---to program the micro-controller---
    If using the avrisp the line would be
    sudo make -f hello.temp.45.make program-avrisp2

    The board is now programmed and generating the raw temp data. The Python code is needed to make a graphic display.

    Using Python to Generate a Graph

  • locate the serial port being used with the following command
    ls /dev/tty.usb*
  • Run the python code using the serial number found
    python hello.mic.45.py /dev/tty.usbserial-XXXXXXXX
    The X's here would be repaced by your serial number before you run the line
  • The Graph should now pop up on your screen.

    The graph should respond to changes in temp such as when you touch the thermistor.

    Currently troubleshooting an issue with unresponsive temp reading. ******Issue resolved by re-flowing all soldered connections

    Custom Remote Temp Board + Fabduino

    I designed a separate temp sensor to be used with the Fabduino.

    The board is designed to be pugged into the programming 6pin header of the fabduino using input pins PB4 and PB2

    Currently working on programming the board